/***********************************************************************
 * Module:  Comment.java
 * Author:  Voja
 * Purpose: Defines the Class Comment
 ***********************************************************************/

package model;

import java.util.*;

public class Comment {
   public int commentId;
   public java.lang.String commentTitle;
   public java.lang.String commentContents;
   public java.util.Date commentDate;
   
   public Photo photo;
   public User user;
   
   
   /** @pdGenerated default parent getter */
   public Photo getPhoto() {
      return photo;
   }
   
   /** @pdGenerated default parent setter
     * @param newPhoto */
   public void setPhoto(Photo newPhoto) {
      if (this.photo == null || !this.photo.equals(newPhoto))
      {
         if (this.photo != null)
         {
            Photo oldPhoto = this.photo;
            this.photo = null;
            oldPhoto.removeComment(this);
         }
         if (newPhoto != null)
         {
            this.photo = newPhoto;
            this.photo.addComment(this);
         }
      }
   }
   /** @pdGenerated default parent getter */
   public User getUser() {
      return user;
   }
   
   /** @pdGenerated default parent setter
     * @param newUser */
   public void setUser(User newUser) {
      if (this.user == null || !this.user.equals(newUser))
      {
         if (this.user != null)
         {
            User oldUser = this.user;
            this.user = null;
            oldUser.removeComments(this);
         }
         if (newUser != null)
         {
            this.user = newUser;
            this.user.addComments(this);
         }
      }
   }

}